home *** CD-ROM | disk | FTP | other *** search
- /* nearest.c
- * AUTHOR: Cy Booker, cy@cheepnis.demon.co.uk
- * LICENSE: FreeWare, Copyright (c) 1995 Cy Booker
- */
-
- #include "internal.h"
-
- #include <assert.h>
-
- #include "OS:macros.h"
-
-
-
- /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
-
- extern bool process_gif_16bpp_nearest_48bit(
- const process_gif *p) {
- byte *rove;
- bits dest;
- int width;
- int x, y;
- const os_colour *palette;
- int line_length;
- bits pixtrans[256];
-
- assert(p);
- assert(p->pixel_width > 0);
- assert(p->pixel_height > 0);
- assert(p->in_palette.colours);
- assert(p->in_palette.ncolours < COUNT(pixtrans));
-
- process_gif_calc_pixtrans(p, pixtrans);
-
- /*
- * not we pre-load values from the process_gif array
- * because it considerably helps the compiler produce better code
- */
- rove = p->buffer;
- width = (p->pixel_width + 1) & ~1;
- palette = p->in_palette.colours;
- line_length = p->line_length;
-
- for (y= p->pixel_height - 1; (y >= 0); y--) {
- for (x= width - 1; (x >= 0); x--) {
- /*
- * writing one 32-bit word is much faster than two 16-bit shorts
- */
- dest = pixtrans[rove[x]];
- x--;
- dest <<= 16;
- dest |= pixtrans[rove[x]];
- *(((int *)rove) + (((unsigned int)x) >> 1)) = dest;
- }
- rove += line_length;
- }
- return FALSE;
- }
-
-
-
-